# -------------------------------------------------------------------------------------- #
#                           Realtime Sonant Synth Makefile                               #
# -------------------------------------------------------------------------------------- #
# For a realtime demo run:                                                               #
# 	make playdemo                                                                    #
#                                                                                        #
# For a demo which writes to a wavfile run:                                              #
# 	make wavdemo                                                                     #
#                                                                                        #
# -------------------------------------------------------------------------------------- #

# -------------------------------------------------------------------------------------- #
# ----------------------------------- [  Options  ] ------------------------------------ #
# -------------------------------------------------------------------------------------- #

PROGRAMS = wavdemo playdemo
RM = /bin/rm
SRC_PATH = includes/rtaudio
INCLUDE = includes/rtaudio
OBJECT_PATH = includes/rtaudio
vpath %.o $(OBJECT_PATH)

OBJECTS	= RtAudio.o 

CC       = g++
DEFS     =   -DHAVE_GETTIMEOFDAY -D__WINDOWS_DS__
CFLAGS   = -O2 -Wall
CFLAGS  += -I$(INCLUDE) -I$(INCLUDE)/include
LIBRARY  = -lole32 -ldsound -lwinmm 

# -------------------------------------------------------------------------------------- #
# ----------------------------------- [  Builds  ] ------------------------------------- #
# -------------------------------------------------------------------------------------- #

%.o : $(SRC_PATH)/%.cpp
	$(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@

all : $(PROGRAMS)

wavdemo:
	$(CC) $(CFLAGS) -o wavdemo wavdemo.c sonant.c includes/WavLib.c

playdemo : playdemo.c $(OBJECTS)
	$(CC) $(CFLAGS) $(DEFS) -o playdemo playdemo.c $(OBJECT_PATH)/*.o $(LIBRARY)

# -------------------------------------------------------------------------------------- #
# ----------------------------------- [  Clean  ] -------------------------------------- #
# -------------------------------------------------------------------------------------- #

clean : 
	$(RM) -f $(OBJECT_PATH)/*.o
	$(RM) -f $(PROGRAMS)
	$(RM) -f *.wav *~ *.exe

distclean: clean
	$(RM) -f Makefile

